<template>
  <div class="showViewboxs" @click="chenge" :class="is_home ? 'showViewboxs2' : ''">
    <div class="showViewboxs_top">
      <span class="showViewboxs_text_size">
        {{ listobjs.school_name }}
      </span>
      <div v-if="scheck">
              <t-checkbox v-model="select" @change="inspect"   style="font-size: 14px;padding: 0;background-color: transparent;"  ></t-checkbox>
            </div>
      <div v-else>
        <t-tag variant="light" theme="warning" v-if="listobjs.status == 1"
          >未核校</t-tag
        >
        <t-tag variant="light" theme="primary" v-if="listobjs.status == 2"
          >已核校</t-tag
        >
        <t-tag variant="light" theme="danger" v-if="listobjs.status == 3"
          >已驳回</t-tag
        >
        <t-tag variant="light" theme="success" v-if="listobjs.status == 4"
          >已通过</t-tag
        >
        <t-tag variant="light" theme="danger" v-if="listobjs.status == 5"
          >问题校</t-tag
        >
      </div>
    </div>
    <div class="showViewboxs_cen">
      <div class="showViewboxs_cen_text">
        <span>区域：</span>
        <span
          >{{ listobjs.province }}{{ listobjs.city
          }}{{ listobjs.county }}(区/县)</span
        >
      </div>
      <div class="showViewboxs_cen_text">
        <span>班级：</span>
        <span>{{ listobjs.grade }}{{ listobjs.class_name }}</span>
      </div>
      <div class="showViewboxs_cen_text">
        <span>学校负责人：</span>
        <span>{{ listobjs.director_name }}</span>
      </div>
      <div class="showViewboxs_cen_text">
        <span>类别：</span>
        <span>{{ listobjs.school_type }}</span>
      </div>
    </div>
    <div>
        <slot name="booton"  >

        </slot>
    </div>
  </div>
</template>


<script>
export default {
  props: {
    is_home:{
      typeof: Boolean,
      default: function () {
        return false;
      },
    },
    listobjs: {
      typeof: Object,
      default: function () {
        return {};
      },
    },
    // 是否全选
    selectArr:{
        typeof: Boolean,
      default: function () {
        return false;
      },
    }, 
    // 是否多选
    scheck: { 
      typeof: Boolean,
      default: function () {
        return false;
      },
    },
  },
  data() {
    return { 
      select: false, //是否选择多选
    };
  },
  mounted() { 
    // 一开始就是全选
        this.select = this.selectArr;
        this.inspect();
  },
  methods: {
    chenge(){
        if(this.scheck){
            this.select = !this.select
            this.inspect(); 
        } 
        else{
        this.$router.push({path:`/H5SchoolDetails`,query:{id:this.listobjs.id}})
          
        }
    },
    inspect(){ 
        this.$emit('inspect',this.select,this.listobjs.id)
    }
  },
};
</script>

<style lang="scss" scoped>
.showViewboxs {
  padding: 10px;
  background: #f6f6f6;
  margin: 10px 0;
  box-sizing: border-box;
  border-radius: 10px;
}
.showViewboxs_text_size {
  color: #030302;
  font-size: 16px;
  font-weight: 500;
  flex-wrap: nowrap;
  width: 80%;
  margin-right: 10px;
  white-space: nowrap; /* 防止文本换行 */
  overflow: hidden; /* 隐藏超出部分 */
  text-overflow: ellipsis; /* 显示省略号 */
}
.showViewboxs_top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.showViewboxs_cen {
  font-size: 12px;
  color: #87898c;
  .showViewboxs_cen_text {
    line-height: 22px;
  }
}
.showViewboxs2{
  background-color: #ffffff !important;
  
}
</style>
